package com.sc.nft.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sc.nft.entity.SaasTaskStageConditions;
import org.apache.ibatis.annotations.Param;
import com.sc.nft.entity.SaasTaskStageConditions;
import org.apache.ibatis.annotations.Select;

import java.util.List;
/**
 * 任务阶段达成条件表(SaasTaskStageConditions)表数据库访问层
 *
 * @author 王伟成
 * @since 2024-04-12 18:35:26
 */
public interface SaasTaskStageConditionsMapper extends BaseMapper<SaasTaskStageConditions> {

    /**
     * 根据任务id,获取他当前最近的一个阶段
     * @param taskId
     * @return
     */
    SaasTaskStageConditions getByTaskIdStageConfig(@Param("taskId") Long taskId);

    @Select("SELECT MAX(upper_limit) FROM sc_saas_task_stage_conditions WHERE saas_task_id = #{taskId}")
    Integer getTaskIdMaxUpperLimit(@Param("taskId") Long taskId);

}
